#ifndef __QR_BASIC_HEAD_FILE__
#define __QR_BASIC_HEAD_FILE__

#include "qrencode.h"
#include "opencv/highgui.h"
#include "opencv/cv.h"
#include <string>
#include "clog.h"

#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif


using namespace std;

class qrBasic {
private:
    int c_size;  // center area size
    int b_size;  // border size
    int f_size;  // offset size, filter size
    int p_size;  // size of one pixcel in qrcode, = csize+2*bsize;
    int width, height;  // image size
    uchar * getDataAt(int x, int y);

    string message;

    IplImage *img;
    IplImage *oriImg;
    QRcode *qrcode;

public:
    qrBasic(int center, int border , string, string);
    ~qrBasic();

    // qrcode related
    uchar getColor(int x,int y);
    bool isCenter(int x, int y);
    bool isUnchangeable(int x, int y);
    // get pic info
    int getWidth();
    int getHeight();
    void showPic(string windowName);
    // set/get pixcel val and calculate visual value;
    uint setPixcelAll(int x, int y, uchar val);
    uint setPixcelR(int x, int y, uchar val);
    uint setPixcelG(int x, int y, uchar val);
    uint setPixcelB(int x, int y, uchar val);
    uint setPixcelRGB(int x, int y, uint val);
    uchar getPixcelR(int x, int y);
    uchar getPixcelG(int x, int y);
    uchar getPixcelB(int x, int y);
    uint getPixcelRGB(int x, int y);
};

#endif